home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
d86bios4.zip
/
BIOS.8
next >
Wrap
Text File
|
1989-04-30
|
22KB
|
462 lines
;---------------
; BIOS module for the D86 debugger
;---------------
; Copyright 1987,88 Eric Isaacson. All rights reserved. Permission to
; copy and use this module is granted ONLY for machines registered for both
; the A86 assembler and the D86 debugger.
; Current support: IBM-PC, Wang PC, TI-PC, Sanyo 555, Tandy 2000,
; and Sirius/Victor 9000, DEC RAINBOW, and Zenith Z-100.
; This module defines the BIOS interface for my D86 debugger. I am publishing
; it to assist those who wish to assist me in implementing D86 on machines not
; BIOS-compatible with the IBM-PC. To support a non-standard BIOS, we must
; provide new keyboard codes, new action routines, and several other data
; quantities. This module provides a routine BIOS_INIT that sets everything
; up according to the machine being used. BIOS_INIT must do four things:
;
; 1. The routine must figure out what machine we are running on. The best
; way to do this is to find a machine-specific identifier in a fixed
; area of memory (ROM or the BIOS). If you can locate such an identifier,
; you can simply create an entry in the BIOS_SIGS structure below.
;
; 2. The routine must point SI to a special data structure (which I'll
; describe shortly), then call the routine NEW_KEYS, to propagate the
; items in the structure to the necessary places throughout the debugger.
;
; 3. The routine must perform any initializations necessary for this BIOS.
; For example, WANG_CONFIG locates and stores the port number for hardware
; that enables video access on the Wang.
;
; 4. The routine must decide if the debugger is running on the same screen as
; the user program. If it is, it must move the user's cursor to the lower
; left corner of the screen.
;
; The structure fed to NEW_KEYS contains all the data necessary for ongoing
; debugger execution under the new BIOS. See the structure WANG_KEYS for a
; prototype. The structure consists of the following:
;
; * a byte giving the keyboard code for the debugger's HELP key.
;
; * a byte declaring the difference between your BIOS's key codes for
; function keys, and the IBM BIOS's key codes. Your BIOS_KEY must return
; consecutive values for the function keys F1 through F10. You should
; declare this byte to be X - FUNC, where X is one less than the code
; returned by the F1 key. For example, since the Wang F1 key returns hex
; 080, the byte is declared 07F - FUNC.
; * a number of bytes giving code values for all the other control keys
; used by the debugger. This list will be expanding with new versions;
; see WANG_KEYS for the current version's list. You should precede the list
; with the L1 label, and follow it with the declaration N_CONTROL_KEYS EQU
; $-L1, exactly as shown. Don't change the name N_CONTROL_KEYS; the
; redeclaration of the same name insures that you've gotten the right number
; of codes into the table.
;
; * a word pointing to a message string with the name of the help-key. If your
; keyboard has a key labelled HELP, use the name HELP_HELP as in WANG_KEYS.
; If there is another key nonexistent on the IBM-PC (e.g. F11), then put
; a new name (e.g. F11_HELP) following DW; I'll supply the definition for
; the new name. If there is no extra key and no HELP key, use Alt-F10 as
; on the IBM-PC, and declare DW ALTF10_HELP here.
;
; * the label L2: to be used to verify the number of following bytes.
;
; * pointers to your BIOS's versions of the procedures VID_COPY, VID_ATTR,
; VID_FIX, BIOS_BELL, and BIOS_KEY, described shortly. Substitute the name
; of your machine for VID and BIOS in the generic names; e.g. the WANG_KEYS
; structure has WANG_COPY, WANG_ATTR, WANG_BELL, and WANG_KEY.
;
; * a word giving the segment register value for video memory on your machine.
; The debugger will supply this value in the ES register when it calls
; VID_COPY and VID_ATTR. That is all the debugger does with it; so this
; value can really be anything that the BIOS's versions of VID_COPY and
; VID_ATTR want.
;
; * a byte giving the attribute value for normal video. This attribute will
; be in effect for the entire debugger screen, except for the location of
; the debugger's cursor.
;
; * a byte giving the attribute value for reverse video. This attribute will
; be used to mark the debugger cursor.
;
; * the declaration N_BIOS_CALLS EQU ($-L2)/2 Again, don't change the name;
; the redeclaration of the name insures you didn't leave anything out.
;
; This completes the description of the structure fed to NEW_KEYS. After
; BIOS_INIT is called, the debugger will keep calling 7 action routines to
; perform its interactive I/O. The routines must perform actions as
; follows:
; VID_COPY copies CL bytes of characters from DS:SI to the video memory whose
; location is given by ES:DI. The characters should have the attribute
; NORM_ATTR, which the caller will place into AH for VID_COPY's convenience.
; VID_COPY must place the character byte and the attribute byte into each
; output video word. VID_COPY must return with BL preserved, the high byte
; of SI preserved (it will be if you leave SI pointing beyond the bytes
; copied), and DI advanced beyond the video memory just output. The caller
; assumes that video memory can be found at the value of VIDEO_SEG set by
; BIOS_INIT, starting at offset 0, and proceeding consecutively, one 16-bit
; memory word for every character. The caller will set CH=0 for its first
; call, so that VID_COPY can use CX as the count; but if it does, it must
; return CH=0 for subsequent calls.
; VID_ATTR places the attribute byte AL into the video word whose location is
; given by ES:DI. The character byte of the video word must not be disturbed.
; VID_FIX restores a video screen that might have been clobbered by programs
; external to the debugger. If VID_COPY copies all characters to video memory
; every time, then VID_FIX should RET without doing anything. If, however,
; VID_COPY tries to keep track of which characters are already on the screen,
; and suppress video output for those that are, then VID_FIX should disable
; the suppression feature, call the debugger's routine REFRESH to update the
; whole screen, then re-enable the suppression feature.
; BIOS_BELL rings the bell. NOTE that it is not acceptible for BIOS_BELL to
; use the MS-DOS write routine to send a bell control-code to standard output;
; if it did, then the debugger couldn't debug programs that have redirected
; their standard output-- the bell code would go to the user program's output
; file, and not be translated into a beep.
; BIOS_KEY returns in AL a code for a single keystroke. The code should be
; compatible with the values placed into the debugger's function tables by
; BIOS_INIT. If there is no keystroke available, BIOS_KEY should wait until
; there is one. BIOS_KEY should return on each individual key, and not wait
; for any line-editing to take place.
; BIOS_SAVE saves whatever there is about the user program's BIOS state that
; might be clobbered by the debugger. Currently, the only such thing is
; the user's cursor position on the Sanyo. So on all machines but the Sanyo,
; this is a "do-nothing" routine.
; BIOS_RESTORE restores the BIOS state saved by BIOS_SAVE. Again, this routine
; does nothing except on the Sanyo, on which it restores the user cursor
; position, clobbered because D86 must use BIOS calls to write to the Sanyo
; screen.
BIOS_SIGNATURE MACRO
DB #1 ; case number for the machine being sought
DB #NL-2 ; number of far pointers to look at
DB >M2 ; length byte for the following string
M1:
DB #2 ; BIOS signature string we are looking for
M2 EQU $-M1 ; we calculate the forward-reference length byte here
#RX3L ; loop for remaining macro operands
DD #X ; far pointers to each place where the string might be found
#ER
#EM
BIOS_SIGS: